<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.infomanage.vo.*"%>
<%@page import="com.infomanage.po.*"%>
<%@page import="com.infomanage.enums.*"%>
<%@page import="com.infomanage.service.worklog.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
    HashMap<AttendanceItem, HashMap<Integer, String>> items = AttendanceStaticsService.search(request, response, out);
	
	int count = 0;
	if(items != null){
		count = items.size();
	}
	
	// 主界面中查询条件
	String personId = request.getParameter("personId");
	if(personId == null) personId = "";
	String timestamp = request.getParameter("timestamp");
	if(timestamp == null) timestamp = "";
	String deptId = request.getParameter("deptId");
	if(deptId == null) deptId = "";
	
	// 当前页号
	String currPageNum = request.getParameter("currPageNum");
	if(currPageNum == null) currPageNum = "1";
	
	// 总总页数
	int totalPageSize = AttendanceStaticsService.getPageCount(request, response, out);
%>
<html>
<head>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<link href="../../css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">
	</script>
</head>
<body rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="parent.clickBody();">
<table width="100%" height="100%"  border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout: fixed;background: #ffffff;">
	<tr height="29px">
        <td valign="middle" height="29px" class="td_title" style="padding-left:20px;border-right: 1px #a3c6e2 solid;">
        	考勤统计
        </td>
    </tr>
    <tr>
    	<td valign="top">
    		 <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="tabMain">
    		 	<col width="5">
    		 	<col width="6">
    		 	<col width="5">
    		 	<%
    		 		for(int i = 3; i < 17; i++){
    		 	%>
    		 	<col width="5%">
    		 	<%
    		 		}
    		 	%>
         		<tr class="thlist">
         			<td>
         				姓名
         			</td>
         			<td>
         				日期
			    	</td>
			    	<td>
			    		所属单位
			    	</td>
			    	<td>
			    		出勤
			    	</td>
			    	<td>
			    		婚产探
			    	</td>
			    	<td>
			    		伤
			    	</td>
			    	<td>
			    		丧
			    	</td>
			    	<td>
			    		节育
			    	</td>
			    	<td>
			    		孩假
			    	</td>
			    	<td>
			    		病假
			    	</td>
			    	<td>
			    		事假
			    	</td>
			    	<td>
			    		旷工
			    	</td>
			    	<td>
			    		夜班
			    	</td>
			    	<td>
			    		轮休
			    	</td>
			    	<td>
			    		节休
			    	</td>
			    	<td>
			    		公假
			    	</td>
			    	<td>
			    		未登记
			    	</td>
         		</tr>
         		
         		<!-- 输出数据 -->
         		<tr valign="top">
         			<td colspan="17" width="100%">
         				<div style="width: 100%;height: 100%;overflow: auto;">
         					<table cellpadding="0" cellspacing="0" class="altColorTable">
         						<col width="5">
				    		 	<col width="6">
				    		 	<col width="5">
				    		 	<%
				    		 		for(int i = 3; i < 17; i++){
				    		 	%>
				    		 	<col width="5%">
				    		 	<%
				    		 		}
				    		 	%>
				    		 	<%
				    		 		int i = -1;
				    		 		if(items != null) {
				    		 			Set<AttendanceItem> staticSet = items.keySet();
				    		 			for(AttendanceItem item : staticSet) {
				    		 				Attendance bean = item.getBean();
				    		 				Person person = item.getPerson();
				    		 				HashMap<Integer, String> attMap = items.get(item);
				    		 				i++;
				    		 	%>
         						<tr class="tdlist">
         							<td>
         								<%=person.getName() %>
         							</td>
         							<td>
         								<%=com.infomanage.util.TimeUtil.toDayTime(bean.getBegintime()) %>
         							</td>
         							<td>
         								<%=person.getDeptName() %>
         							</td>
         							<td>
         								<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.CQ.value()) %>
         							</td>
         							<td>
         								<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.HCT.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.SHJ.value())%>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.SAJ.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.JY.value())%>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.HJ.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.BJ.value())%>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.SJ.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.KG.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.YB.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.LX.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.JX.value()) %>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.GJ.value())%>
         							</td>
         							<td>
         							<%=AttendanceStaticsService.getAttendanceResult(attMap, AttendanceResultType.WDJ.value()) %>
         							</td>
         						</tr>
				    		 	
				    		 	<%	
				    		 			}
				    		 		}
				    		 	%>
         					</table>
         				</div>
         			</td>
         		</tr>
         	 </table>
    	</td>
    </tr>
    
    <!-- 分页 -->
    <tr height="20px">
    	<td class="tabMainBot">
    		<jsp:include page="../common/pagination.jsp" flush="true">
    			<jsp:param name="totalPageSize" value="<%=totalPageSize%>"/>
    			<jsp:param name="currPageNum" value="<%=currPageNum%>"/>
    		</jsp:include>
    	</td>
    </tr>
</table>
<iframe src="#" name="actionFrame" style="display: none;"></iframe>

<!-- 分页表单 -->
<form name="pageForm" action="">
	<input type="hidden" name="currPageNum" value="<%=currPageNum%>">
	<input type="hidden" name="totalPageSize" value="<%=totalPageSize%>">
	<!-- 查询参数 -->
	<input type="hidden" name="timestamp" value="<%=timestamp%>">
	<input type="hidden" name="personId" value="<%=personId %>">
	<input type="hidden" name="deptId" value="<%=deptId %>">
</form>
</body>
</html>
